<?php

namespace App\Http\Controllers\User;

use App\Http\Common\BaseController;
use App\Models\Banner;

class LzSpecialUseController extends BaseController
{
    public function getGoodList(){
        $result = [
            [
                'goodsId'   =>  0,
                'spanSize'  =>  4,
                'banners'   => []
            ]
        ];

        $banners = Banner::select('url')->limit(3)->get()->toArray();

        for ($i = 0; $i < count($banners); $i++){
            $result[0]['banners'][$i] = $banners[$i]['url'];
        }

        for ($i = 1; $i <= 20; $i++){
            $result[$i]['goodsId'] = $i;
            $result[$i]['text'] = "智能生活，从这里开始" . $i;
            $result[$i]['imageUrl'] = $banners[0]['url'];
            $result[$i]['spanSize'] = $i;
        }

        return $this->returnJson(BaseController::SUCCESS, 'Data success', $result);
    }

    public function getGoodDetail(){
        $result = [
            'content'   =>  '内容描述',
            'banners'   =>  [
                '1', '2', '3'
            ],
            'tabs'      =>  [
                [
                    'name'  =>  '商品详情',
                    'pictures'  =>  [
                        '4'
                    ]
                ],
                [
                    'name'  =>  '规格参数',
                    'pictures'  =>  [
                        '1'
                    ]
                ]
            ],
            'specifications'    =>  '规格参数',
            'inventory'     =>  '商品中包含了哪些东西 的清单',
            'id'    =>  1,
            'name'  =>  '商品名' . rand(1, 100),
            'description'   =>  "描述描述描述" . rand(1, 100),
            'price' =>  12.00,
            'thunb' =>  "1"
        ];
        return $this->returnJson(BaseController::SUCCESS, 'Data success', $result);
    }
}
